package com.cavas.domain.bean;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="membre")
public class Membre implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "membreId")
	private Integer membreId;
	
	//@Pattern(regexp="[_a-z0-9A-Z_]+", message="entrer un nom valide!")
	private String nom;
	
	//@Pattern(regexp="[_a-z0-9A-Z_]+", message="entrer un nom valide!")
	private String prenom;
	
	//@Pattern(regexp="[_a-z0-9A-Z_]+@[_a-z0-9A-Z_]\\.[a-z]{2,3}", message="entrer un address email valide!")
	private String email;

	//@Pattern(regexp="\\d{2}-\\d{2}-\\d{4}", message="entrer un nom valide!")
	private String inscription;
	
	//@Pattern(regexp="[0-9]{10}", message="Numero de telephone non formel")
	private String telephone;
	
	//@Pattern(regexp="[a-z0-9]{6,}", message="le mot de passe doi contenir au moins 7 lettres")
	private String password;
	
	private Integer statue;
	
	
	@JoinTable(name="fonction_membre", 
			   joinColumns=@JoinColumn(name="id_membre", referencedColumnName="membreId"),
			   inverseJoinColumns=@JoinColumn(name="id_fonction", referencedColumnName="id")
	)
	@OneToOne
	private Fonction fonction;

	public Integer getMembreId() {
		return membreId;
	}

	public void setMembreId(Integer id) {
		this.membreId = id;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getInscription() {
		return inscription;
	}

	public void setInscription(String inscription) {
		this.inscription = inscription;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getStatue() {
		return statue;
	}

	public void setStatue(Integer valide) {
		this.statue = valide;
	}

	public Fonction getFonction() {
		return fonction;
	}

	public void setFonction(Fonction fonction) {
		this.fonction = fonction;
	}
	
}
